//Win32 API needed
[DllImport("user32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern long SetWindowPos(long hWnd, long hWndInsertAfter, long X, long Y, long cx, long cy, long wFlags);

[DllImport("user32", EntryPoint = "FindWindowA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern long FindWindow(string lpClassName, string lpWindowName);

//constants needed
private const int SWP_HIDEWINDOW = 0x80;
private const int SWP_SHOWWINDOW = 0x40;

/// <summary>
/// method for handling the hiding & showing of the Windows Taskbar
/// </summary>
/// <param name="show">condition: are we hiding or showing</param>
/// <returns>true/false</returns>
public bool ShowHideWindowsTaskBar(bool show)
{
    try
    {
        //get the handle
        long hWnd = FindWindow("Shell_traywnd", "");

        //decide if we're hiding or showing the Taskbar
        switch (show)
        {
            case true:
                //show the Taskbar
                SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
                break;
            case false:
                //hide the Taskbar
                SetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);
                break;
        }
        return true;
    }
    catch (Win32Exception ex)
    {
        MessageBox.Show(ex.ToString());
        return false;
    }
    
}